<%--
 *  File:    PrivListSummary.jsp
 *  @Author: Langerwang 
 *  Date:    2001/11/4
 *
 *  Copyright (C) 2000 - 2001 Oval Technologies, Inc.
 *  All rights reserved. 
 *
 *  This software is the confidential and proprietary information of Oval 
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>


<%@ include file="/inc/SessionTimeout.inc"%>
<%@ page language="java" %>     
<%@ page import="java.util.*" %>
<%@ page import="org.apache.log4j.Category" %>
<%@ page import="com.oval.util.OvalLabel" %>
<%@ page import="com.oval.util.OvalCustomColumn" %>
<%@ page import="com.oval.util.OvalCustomMessage" %>

<%@ page contentType = "text/html;charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom" %>

<% //--------------------------------------  setting logger --%>
<%
  	Category cat = Category.getInstance("jsp.PrivListSummary"); 
%>

<%
    String privilegeCode = "Z0201,L403";
  	String strTableName = "ovprivlist";
  	String strModuleName = "UPM";
%>



<% //--------------------------------------  include files list --%>
<%@ include file="/inc/Security.inc" %>
<%@ include file="/inc/PageDefault.inc" %>
<%@ include file="/inc/LocationDefault.inc" %>

<html>
<head>
<title>PrivListSummary</title>
<PageFlow:CheckPageFlow pageName="privlistsummary"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../css/<%= strLanguageCode %>/main.css" type="text/css">
<script language="JavaScript" src="../../css/<%= strLanguageCode %>/script.js">
</script>
<%@ include file="/inc/SummaryDivision.inc" %>

<%--------------------------------------  output variant from pageflow   --%>
<%
	Vector privListSummary = (Vector)pageContext.getAttribute("allprivlist");
  	if(privListSummary == null)
  	{
    	privListSummary = new Vector();
  	}
%>
<script language="JavaScript" src="../../js/FuncLib.js"></script>
<script>

parent.down.location.href = "Blank.jsp?<%= OvalTools.randomURL() %>";
function clickPrivList(id)
{
  parent.down.location.href = "Blank.jsp?<%= OvalTools.randomURL() %>";
  document.privlistsummaryform.privlistid.value = id;
}
function page_summary(actionvalue,orderbyname)
{
  var editform = summaryPrepare(privlistsummaryform,actionvalue,orderbyname);
  editform.action = "PrivListSummary.jsp?<%= OvalTools.randomURL() %>";
  editform.target = "_self";
  isRunning = true;
  editform.submit();  
}

function page_delete()
{
  var uid = document.privlistsummaryform.privlistid.value;
  if(uid == null || uid.length == 0 || uid == "" || uid == "-1")
    return;
  var flag = confirm("<%= message.getMessageDesc("ARE_YOU_SURE_DEL") %>");
  if(!flag)
    return;
  document.privlistsummaryform.actionname.value = "delete";
  isRunning = true;
  document.privlistsummaryform.submit();
}
function page_edit()
{
  var uid = document.privlistsummaryform.privlistid.value;
  if(uid == null || uid.length == 0 || uid == "" || uid == "-1")
    return;
  parent.down.location.href = "PrivListEdit.jsp?<%= OvalTools.randomURL() %>&privlistid=" + uid + "&languagecode=<%= strLanguageCode %>";
}

</script>
</head>
<body>
	<%--------------------------------------  hidden form variant   --%>
	<form name="privlistsummaryform" method="post" action="../../Dispatcher" target="_parent">
    <input type="hidden" name="pagename" value="privlistsummary">
    <input type="hidden" name="actionname">
    <input type="hidden" name="languagecode" value="<%= strLanguageCode %>">
    
	
	<%--------------------------------------  page location   --%>
	<%@ include file="/inc/PageLocation.inc" %>


	<table width="100%" cellspacing="0" border="0" cellpadding="0">
  
    
  	<tr> 
    	<td> 
      		<table width="100%" border="0" cellspacing="0">
        	<tr> 
          		<td class="summary_top" colspan="2" ></td>
        	</tr>
          	<%@ include file="/inc/SummarySearch.inc" %>
      		</table>
      		
      		<table width="100%" border="1" cellpadding="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" cellspacing="0" align="center">
      		
      		<%--------------------------------------  summary header   --%>
        	<tr class="deepblue-left"> 
          		<td width="5%" class="title_center">&nbsp;</td>
          		<td width="14%" class="title_center"><a href="javascript:page_summary('orderby','privlistcode')"><%= label.getLabelName("L_PrivListCode") %></a></td>
          		<td class="title_center" width="15%"><a href="javascript:page_summary('orderby','privlistname')"><%= label.getLabelName("L_PrivListName") %></a></td>
          		<td class="title_center"><a href="javascript:page_summary('orderby','privlistdesc')"><%= label.getLabelName("L_Description") %></a></td>
        	</tr>
        	
          	<%
            	int i = 0;
             	int j = 0;
             	boolean bHasChecked = false;
             	String strClassType = new String(); 
             	Integer nDefaultPrivListId = null;               
          	%>
          
          	<logic:iterate id="privlist" collection="<%= privListSummary %>"> 
          	<%
            	HashMap privListMap = (HashMap)pageContext.getAttribute("privlist");             
            	String strPrivListCode = (String)privListMap.get("privlistcode");
            	String strIsChecked = new String("");
            	String strIsDisabled = new String("");
            	if(j%2 == 1){
              		strClassType = "td-listrom";             
            	}else{                    
              		strClassType = "";
            	}   

            	if(strPrivListCode.equalsIgnoreCase("UPM1") || strPrivListCode.equalsIgnoreCase("UPM2"))
            	{
              		strIsDisabled = new String(" Disabled ");
            	  	nDefaultPrivListId = new Integer(-1);  
            	  	privListMap.put("privlistid","-1");
            	} 
            	else if(!bHasChecked)
            	{
              		strIsChecked = "Checked";                       
              		bHasChecked = true;            
              		nDefaultPrivListId = (Integer)(privListMap.get("privlistid"));            
            	}
            	j++;    
          	%>
              <tr onmouseover="this.className='tr-over'" onmouseout="this.className='<%=JspHelper.filterNull(strClassType)%>'"  onClick="javascript:radiotrue('privlist<%=JspHelper.filterNull(j)%>');clickPrivList('<%=JspHelper.filterNull( privListMap.get("privlistid") )%>')" class="<%=JspHelper.filterNull(strClassType)%>">
          
            	<td width="5%" > 
            		<input type="radio" id="privlist<%=JspHelper.filterNull(j)%>" name="checkprivlist" <%=JspHelper.filterNull( strIsDisabled )%> value=<%=JspHelper.filterNull( privListMap.get("privlistid") )%> class="checkbox" <%=JspHelper.filterNull( strIsChecked)%> onClick="javascript:clickPrivList('<%=JspHelper.filterNull( privListMap.get("privlistid") )%>')">
            	</td>
            	<td >&nbsp;<a href="PrivListDetail.jsp?<%= OvalTools.randomURL() %>&privlistid=<%=JspHelper.filterNull( privListMap.get("privlistid") )%>&&privlistcode=<%=JspHelper.filterNull( privListMap.get("privlistcode") )%>" target="down"><%=JspHelper.filterNull( privListMap.get("privlistcode") )%></td>
            	<td >&nbsp;<%=JspHelper.filterNull( privListMap.get("privlistname") )%></td>
            	<td >&nbsp;<%=JspHelper.filterNull( privListMap.get("privlistdesc") )%></td>
          	</tr>
          	</logic:iterate>  
          	
          	<%--------------------------------------  default value    --%>
          	<input type="hidden" name="privlistid" value="<%=JspHelper.filterNull( nDefaultPrivListId )%>">

          	<%--------------------------------------  flipping page   --%>
   		<%@ include file="/inc/SummaryAction.inc" %>
    </table>
      
      	<%--------------------------------------  page operation button  --%>      
      	<table width="100%" cellspacing="0" cellpadding="0">
      	<tr> 
        	<td class="summary_top"></td>
        </tr>
        <tr> 
        	<td class="td_center">
          		<a onclick="parent.down.location.href='PrivListEdit.jsp?<%= OvalTools.randomURL() %>';"><custom:button type="1" label="L_New" imgsrc="new.gif" border="0" style="width:60"/></a>&nbsp;
          		<a onclick="page_edit()"><custom:button type="1" label="L_Edit" imgsrc="edit.gif" border="0" style="width:60"/></a>&nbsp;
          		<a onclick="page_delete()"><custom:button type="1" label="L_Delete" imgsrc="delete.gif" border="0" style="width:60"/></a>
          </td>
        </tr>
      	</table>
      
	</td>
</tr>
</table>
</form>  
</body>
</html>


